﻿using BasehInfoManager_IDal;
using BasehInfoManagerModel;
using BasehInfoManagerViewModel;
using BasehInfoManagerViewModel.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BaseInfoManagerBll
{
   public  class RoleDbBll
    {

        //接口依赖注入
        private IRoleDbDal _iRoleDbDal;
       

        public RoleDbBll(IRoleDbDal iRoleDbDal)
        {
            _iRoleDbDal = iRoleDbDal;
        }

        //分页
        public PagerResult<RoleDb> SearchPage(SearchModel searchModel)
        {
            return _iRoleDbDal.Searchpage(searchModel);
        }


        //角色添加
        public int RoleDbAdd(RoleDbView view)
        {
            //时间添加
            view.creator_date = DateTime.Now;
            //创建人添加
            view.creator_name = "张三";
            return _iRoleDbDal.RoleDbAdd(view);
        }

        //反填
        public RoleDbView GetRoleViewById(int roleId)
        {
            return _iRoleDbDal.GetRoleViewById(roleId);
        }

        //修改
        public bool RoleUpdate(RoleDbView view)
        {
            view.modifi_date = DateTime.Now;
            view.modifi_name = "李四";
            return _iRoleDbDal.RoleUpdate(view);
        }

    }
}
